/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       rendertarget.h
 * Author:     twoja stara
 * Created on: 2009-09-16
 *
 **********************************************************************************************************************/

#ifndef RENDERTARGET_H_
#define RENDERTARGET_H_

#include "../common.h"

namespace mGameEngine
{
namespace Graphics
{

/**
 * Interface for any rendering target.
 */
class RenderTarget
{
protected:
    /**
     * Size
     */
    Vector2 _size;

    // TODO statistics

public:
    /**
     * Create render target.
     */
    RenderTarget();

    /**
     * Destroy render target.
     */
    virtual ~RenderTarget();

    /**
     * Get render target size.
     * @return render target size.
     */
    const Vector2 &getSize() const
    {
        return _size;
    }

    /**
     * Set render target size.
     * @param size size.
     */
    virtual void setSize(const Vector2 &size)
    {
        _size = size;
    }

    /**
     * Get render target aspect ratio (width/height).
     * @return render target aspect ratio.
     */
    float getAspectRatio() const
    {
        return _size.y != 0.0f ? float(_size.x) / float(_size.y) : 0.0f;
    }

    /**
     * Begin rendering to render target.
     */
    virtual void beginRendering() = 0;

    /**
     * End rendering to render target.
     */
    virtual void endRendering() = 0;
};

}
}

#endif // RENDERTARGET_H_
